package Work;

import java.util.Arrays;

public class TowNumSum {
    public static void main(String[] args) {
        int[] array = {5,3,7,9,6,4,2};
        int target = 6;
        System.out.println(Arrays.toString(numSum(array,target)));
    }

    public static int[] numSum(int[] array, int target) {
        int[] ret = {-1,-1};
        for (int left = 0; left < array.length-1; left++) {
            for (int right = left+1; right < array.length; right++) {
                if(array[left] + array[right] == target) {
                    ret[0]=left;
                    ret[1]=right;
                    return ret;
                }
            }
        }
        return ret;
    }
}
